package com.travel.controller;

import com.travel.Service.HotelSearchService;
import com.travel.pojo.Hotel;
import io.swagger.annotations.*;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/hotelSearch")
@Api("酒店表es查询接口")
public class HotelSearchController {

    @Resource
    private HotelSearchService hotelSearchService;

    @GetMapping("/search")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "keyword", value = "关键字", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "pageNumber", value = "页码", required = false, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "每页大小", required = false, dataType = "int", paramType = "query")
    })
    public Page<Hotel> search(@RequestParam String keyword,
                              @RequestParam(defaultValue = "0") int pageNumber,
                              @RequestParam(defaultValue = "10") int pageSize) {
        return hotelSearchService.search(keyword, pageNumber, pageSize);
    }

    @GetMapping("/estest")
    public String estest(){
        System.out.println("ahiahkdashihsda");
        return "链接成功";
    }

}
